package com.gxa.adput.controller;

import com.gxa.adput.service.AdPutService;
import com.gxa.common.R;
import com.gxa.common.entity.platform_maintenance_service1001.AdPut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;


@RestController
@RequestMapping("/adPut")
@EnableScheduling
public class AdPutController {

    @Autowired
    public AdPutService adPutService;

    /**
     * 1.添加平台通知
     * @param adPut
     * @return
     */
    @PostMapping("/addAdPut")
    public R addAdPut(@RequestBody AdPut adPut){
        return adPutService.addAdPut(adPut);
    }


    /**
     * 2.修改平台通知
     * @param adPut
     * @return
     */
    @PostMapping("/updateAdPut")
    public R updateAdPut(@RequestBody AdPut adPut){
        return adPutService.updateAdPut(adPut);
    }

    /**
     * 3.根据分页查询平台通知
     * @param currentPage
     * @param pageSize
     * @return
     */
    @GetMapping("/selectAdPut")
    public R selectAdPut(Integer currentPage,Integer pageSize){
        return adPutService.selectAdPut(currentPage,pageSize);

    }

    /**
     * 4.按照条件查询

     * @return
     */
    @PostMapping("/selectAdPutByCondition")
    public R selectAdPutByCondition(@RequestBody AdPut adPut){

        return adPutService.selectAdPutByCondition(adPut);
    }


    /**
     * 5.删除
     * @param adPut
     * @return
     */
    @PostMapping("/delAdPutById")
    public R delAdPutById(@RequestBody AdPut adPut){
        return adPutService.delAdPutById(adPut);
    }

    /**
     * 6.查询全部
     * @return
     */
    @PostMapping("/selectAdPutAll")
    public R selectAdPutAll(){
        return adPutService.selectAdPutAll();
    }

    /**
     * 7.定时推送
     * @return
     */
//    @Scheduled(cron =" )
//    @PostMapping("/timedPush")
//    public R timedPush(@RequestBody AdPut adPut){
//        System.out.println("=========执行定时任务=========");
//        return null;
//    }

    final String a="0 43 21 10 10 *";

    @GetMapping("/getTime")
    public void getTime(int a,int b,int c,int d){


    }



//    @Scheduled(cron = a)
//    public R imedPush(){
//        System.out.println("=========执行定时任务=========");
//        return null;
//    }

    //SpringTask    websocket


}
